import { createSlice } from "@reduxjs/toolkit";

const initialState = {
  upLoadShowFlag: false,
  tabsList: [],
};

const scientificResearchManagementSystemStore = createSlice({
  name: "scientificResearchManagementSystem",
  initialState,
  reducers: {
    toggleUploadFlag: (state) => {
      state.uploadflag = !state.uploadflag;
    },
    toggleAddTabsList: (state, { payload }) => {
      console.log(payload)
      if (!state.tabsList.includes(payload)) {
        state.tabsList = [...state.tabsList, payload];
      }
    },
    toggleDeleteTabsList: (state, { payload }) => {
      state.tabsList = state.tabsList.filter(item => item !== payload)
    },
  },
});

export const { toggleUploadFlag, toggleAddTabsList, toggleDeleteTabsList } = scientificResearchManagementSystemStore.actions;


export default scientificResearchManagementSystemStore.reducer;